package com.tledu.jsoup;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;
import java.lang.annotation.Documented;
import java.net.MalformedURLException;
import java.net.URL;

public class XinlangJsoup {
    public static void main(String[] args) throws IOException {
        String url = "https://www.sina.com.cn/";
        Document document = Jsoup.parse(new URL(url), 10000);
        // 通过这个对象就可以获取网站中的数据
        Element element = document.getElementById("first_list");
        // innerHTML
        System.out.println(element.html());
        Elements children = element.children();
        for (Element item : children) {
            System.out.println(item.text());
        }
    }
}
